<template>
	<view class="container-myPurse">
		<view class="lang-top-view">
			<view class="lang-top">
				<view class="backIcon" @click="back()">
					<uni-icons type="left" size="26" color="#fff"></uni-icons>
				</view>
				<view class="langText">
					{{$t('提现记录')}}
				</view>
				<view class="clearView"></view>
			</view>
			
		</view>
		<view class="top-text">
			<p class="totalMoney">{{$t('总余额')}}</p>
			<p class="balance">$<span class="balance-num">{{user.balance}}</span></p>
			<view class="btn-group">
				<view class="turn-in" @click="gotoRecharge">
					{{$t('转入')}}
				</view>
				<view class="turn-out"  @click="gotoWithdraw">
					{{$t('转出')}}
				</view>
			</view>
		</view>
		<view class="content-view">
			<view v-if="contentList.length==0"  class="nodetaView">
				<image src="../../static/home/nodeta.png" class="nodetaImg"></image>
				<p class="nodetaText">{{$t('暂无数据')}}</p>
			</view>
			<view v-else  class="item-list" v-for="(item,index) in contentList" :keys="index">
				<view  class="de_wrap">
					<p  class="tit" v-if="item.status == 0"><span>{{$t('待审核')}}</span></p>
					<p  class="tit" v-if="item.status == 1"><span>{{$t('审核通过')}}</span></p>
					<p  class="tit" v-if="item.status == 2"><span>{{$t('驳回')}}</span></p>
					<p  class="time">{{item.create_at}}</p>
				</view>
				<view  class="price">$<span>{{item.num}}</span></view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				contentList:[
					// {
					// 	behavior:'每日签到，奖励',
					// 	num:'5.00',
					// 	time:'2024-04-16 03:51:14'
					// },
					// {
					// 	behavior:'每日签到，奖励',
					// 	num:'5.00',
					// 	time:'2024-04-13 08:34:18'
					// },
					// {
					// 	behavior:'会员注册，系统赠送',
					// 	num:'300.00',
					// 	time:'2024-04-12 06:51:23'
					// }
				],
				user:{}
			}
		},
		onShow() {
			this.getinfo()
			this.getlist()
		},
		methods:{
			getlist(){
				this.$http.get(
					'api/withdrawal/index',//接口名
					{},//参数合集
					{},
					false
				).then(res=>{
					this.contentList = res.data.data.data
					// console.log(this.contentList)
				},(err)=>{//失败的操作
					uni.showToast({
						icon: 'error',
						title: err.data.message
					});
				})
			},
			getinfo(){
				this.$http.get(
					'api/user/index',//接口名
					{},//参数合集
					{},
					false
				).then(res=>{
					this.user = res.data
				},(err)=>{//失败的操作
					uni.showToast({
						icon: 'error',
						title: err.data.message
					});
				})
			},
			back(){
				uni.switchTab({
					url:'/pages/my/index'
				})
			},
			gotoRecharge(){
				uni.navigateTo({
					url:'/pages/index/recharge'
				})
			},
			gotoWithdraw(){
				uni.navigateTo({
					url:'/pages/index/withdraw'
				})
			}
		}
	}
</script>

<style scoped>
	.nodetaView{
		text-align: center;
		background-color: #f6f6f6;
		padding:64rpx 0;
	}
	.nodetaImg{
		width:320rpx;
		height:320rpx;
	}
	.nodetaText{
		font-size:28rpx;
		color:#969799;
	}
	.price{
	    flex: 1;
	    font-size: 20px;
	    line-height: 28px;
	    font-weight: 700;
	    text-align: right;
	    color: #f12211;
	    white-space: nowrap;
	}
	.time{
		font-size: 12px;
		color: rgba(0, 0, 0, .8);
		line-height: 17px;
		margin-top: 10px
	}
	.tit{
	    font-size: 14px;
	    color: rgba(0, 0, 0, .8);
	    line-height: 20px;
	    font-weight: 700;
	}
	.de_wrap{
		flex:2;
	}
	.item-list{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 8px;
		border-bottom: 1px solid #ececec;
	}
	.btn-group{
		padding:30rpx 0 4rpx 0;
	}
	.turn-in,.turn-out{
		width:48%;
		background: #0a5;
		color: #fff;
		margin: 0 20px;
		border-radius: 5px;
		font-size: 12px;
		height:72rpx;
		line-height: 72rpx;
	}
	.btn-group{
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.balance{
		font-size: 20px;
		font-weight: 700;	
	}
	.totalMoney{
		font-size: 16px;
		color: #646566;
		margin-bottom: 20px;
	}
	.top-text{
		text-align: center;
		width: 96%;
		background: #fff;
		border-radius: 5px 5px 0 0;
		padding: 20px 0;
		margin:0 auto;
		margin-top:-100rpx;
	}
	.container-myPurse{
		background-color: #f6f6f6;
	}
	.lang-top{
		display: flex;
		padding-left:10rpx;
		height:88rpx;
		line-height:88rpx;
		background-color: #0a5;
	}
	.backIcon{
		width:20%;
	}
	.langText{
		font-size:36rpx;
		width:60%;
		text-align: center;
		
	}
	.clearView{
		width:20%;
	}
	.lang-top-view{
		height:252rpx;
		background-color: #0a5;
		color:#fff;
	}
	
	.content-view{
		font-size:24rpx;
		width: 96%;
		background: #fff;
		border-radius: 5px 5px 0 0;
		margin:20rpx auto;
		
	}
	.content-view>p{
		width: 100%;
		line-height: 88rpx;
		height: 88rpx;
		font-size: 28rpx;
		color: #000;
		padding: 0 28rpx;
		background: #fafafa;
		font-size: 28rpx;
		font-weight: 600;
	}
	.nodata-text{
		margin-top: 12rpx;
		padding: 0 120rpx;
		color: #969799;
		font-size: 28rpx;
		line-height: 40rpx;
		text-align: center;
	}
</style>